home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-09 | 8.3 KB | 337 lines | [TEXT/R*ch] |
- /*====================================================================
- TapBarModule.def TapBar Module Interface file.
-
- ©1995-1996 Yosuke "Basuke" Suzuki.
-
- Date Who Comment
- --------------------------------------------------------------
- 12/16/95 Basuke initial draft
-
- 12/27/95 Basuke change the structure of globals
- add palette definition
-
- 3/15/96 Basuke change its name as "TapBar"
- add ReallyEnsureInternal interface (debugging)
- change :ClickFinish() to ClickFinish(success)
-
- 3/28/96 Basuke 1.0a0 release
-
- 4/3/96 Basuke now buttons can send Change ClickStart and
- ClickFinish message directly to itself, not
- its parent. More to say it should do so.
-
- 4/6/96 Basuke add function to display icons instead of
- default arrows. use arrowIcons slot.
-
- 4/6/96 Basuke add grouping facility. bar can have its own
- group symbol, and buttons with same group
- will be added into that bar. the bar with
- group cannot be deleted by user.
-
- 4/10/96 Basuke 1.0a1 release
-
- 4/11/96 Basuke change global frame structure not to hold
- preference soup entry.
-
- 4/13/96 Basuke move all static text into localization frame
- so that easily translate into Japanese using
- language preference.
-
- 4/14/96 Basuke add interface to change button order and
- to turn it on and off.
-
- 4/15/96 Basuke 1.0b0 release
-
- 4/16/96 Basuke change app interface.
-
- 4/16/96 Basuke add dontFormat option.
-
- 4/16/96 Basuke 1.0b1 release
-
- 4/17/96 Basuke add function to add buttons into status bar.
-
- 4/17/96 Basuke 1.0b2 release
-
- 4/18/96 Basuke add groupOnly option to both buttons and bars.
- if this slot is true in button, it won't appear
- on bars except its group. if this slot is true
- in bar, only its group buttons will appear on it.
-
- 5/9/96 Basuke 1.0 release
-
- ====================================================================*/
-
- // ---------------------------------------------
- // kTapBarAppSym
- // ---------------------------------------------
- // symbol of TapBar application
-
- constant kTapBarAppSym := '|TapBar:BASUKE|;
-
-
- // ---------------------------------------------
- // kTapBarModuleRegistrySym
- // ---------------------------------------------
- // symbol of module registry
-
- constant kTapBarModuleRegistrySym := '|Module:TapBar:BASUKE|;
-
-
- // ---------------------------------------------
- // kReallyEnsureInternalFunc
- // ---------------------------------------------
- // EnsureInternal only if it installed on external memory
-
- DefConst('kReallyEnsureInternalFunc,
- func(object)
- begin
- local onInternal :=
- (GetVBOStore(ObjectPkgRef(object)) = GetStores()[0]);
-
- if onInternal then
- object;
- else
- EnsureInternal(object);
- end);
-
-
- // ---------------------------------------------
- // kNotifyTapBarButtonRegistryFunc
- // ---------------------------------------------
- // function to notify change of button registry
-
- DefConst('kNotifyTapBarButtonRegistryFunc,
- func(what, who)
- begin
- local tb := GetGlobals().(kTapBarAppSym);
- if tb then
- tb:PrefChanged(what, who);
- end);
-
-
- // ---------------------------------------------
- // kGetTapBarModulePrefFunc
- // ---------------------------------------------
- // function to get pref frame of each module
-
- DefConst('kGetTapBarModulePrefFunc,
- func(symbol)
- begin
- local tb := GetGlobals().(kTapBarAppSym);
- if tb then
- tb:GetTapBarModulePref(symbol);
- else
- {};
- end);
-
-
- // ---------------------------------------------
- // kSetTapBarModulePrefFunc
- // ---------------------------------------------
- // function to set pref frame of each module
-
- DefConst('kSetTapBarModulePrefFunc,
- func(symbol, value)
- begin
- local tb := GetGlobals().(kTapBarAppSym);
- if tb then
- tb:SetTapBarModulePref(symbol, value);
- end);
-
-
- // ---------------------------------------------
- // kGetTapBarModuleRegistryFunc : internal use
- // ---------------------------------------------
- // function to get module registry frame
-
- constant kDefaultModuleRegistry := '{
- buttons: {}, // actual button templates
- prefs: {}, // pref panel templates
- palettes: {}, // palette definitions
- };
-
-
- DefConst('kGetTapBarModuleRegistryFunc,
- func()
- begin
- if NOT HasSlot(GetGlobals(), kTapBarModuleRegistrySym) then
- begin
- local sym := EnsureInternal(kTapBarModuleRegistrySym);
-
- GetGlobals().(sym) := TotalClone(kDefaultModuleRegistry);
- end;
-
- GetGlobals().(kTapBarModuleRegistrySym);
- end);
-
-
- // ---------------------------------------------
- // kRegTapBarSymbolFunc : internal use
- // ---------------------------------------------
- // function to register frmae into slot
-
- DefConst('kRegTapBarSymbolFunc,
- func(frameBase, sym, frame)
- begin
- if sym AND frame then
- begin
- local registry;
-
- registry := (call kGetTapBarModuleRegistryFunc with ());
-
- if NOT HasSlot(registry, frameBase) then
- begin
- frameBase := EnsureInternal(frameBase);
- registry.(frameBase) := {};
- end;
-
- sym := EnsureInternal(sym);
- registry.(frameBase).(sym) := frame;
-
- sym;
- end
- end);
-
-
- // ---------------------------------------------
- // kUnRegTapBarSymbolFunc : internal use
- // ---------------------------------------------
- // function to register frmae from slot
-
- DefConst('kUnRegTapBarSymbolFunc,
- func(frameBase, sym)
- begin
- if sym then
- begin
- local registry := (call kGetTapBarModuleRegistryFunc with ());
-
- RemoveSlot(registry.(frameBase), sym);
- end
- end);
-
-
- // ---------------------------------------------
- // kRegTapBarButtonFunc
- // ---------------------------------------------
- // function to register button
-
- DefConst('kRegTapBarButtonFunc,
- func(sym, button)
- begin
- local slot := call kRegTapBarSymbolFunc
- with ('buttons, sym, button);
-
- call kNotifyTapBarButtonRegistryFunc with ('buttonAdded, sym);
-
- return slot;
- end);
-
-
- // ---------------------------------------------
- // kUnRegTapBarButtonFunc
- // ---------------------------------------------
- // function to unregister button
-
- DefConst('kUnRegTapBarButtonFunc,
- func(sym)
- begin
- call kUnRegTapBarSymbolFunc with ('buttons, sym);
-
- call kNotifyTapBarButtonRegistryFunc with ('buttonRemoved, sym);
- end);
-
-
- // ---------------------------------------------
- // kRegTapBarPrefFunc
- // ---------------------------------------------
- // function to register pref panel
-
- DefConst('kRegTapBarPrefFunc,
- func(sym, pref)
- begin
- local slot := call kRegTapBarSymbolFunc
- with ('prefs, sym, pref);
-
- call kNotifyTapBarButtonRegistryFunc with ('prefAdded, sym);
-
- return slot;
- end);
-
-
- // ---------------------------------------------
- // kUnRegTapBarPrefFunc
- // ---------------------------------------------
- // function to unregister pref panel
-
- DefConst('kUnRegTapBarPrefFunc,
- func(sym)
- begin
- call kUnRegTapBarSymbolFunc with ('prefs, sym);
-
- call kNotifyTapBarButtonRegistryFunc with ('prefRemoved, sym);
- end);
-
-
- // ---------------------------------------------
- // kRegTapBarPaletteFunc
- // ---------------------------------------------
- // function to register palette definition
-
- DefConst('kRegTapBarPaletteFunc,
- func(sym, paletteDef)
- begin
- local slot := call kRegTapBarSymbolFunc
- with ('palettes, sym, paletteDef);
-
- call kNotifyTapBarButtonRegistryFunc with ('paletteAdded, sym);
-
- return slot;
- end);
-
-
- // ---------------------------------------------
- // kUnRegTapBarPaletteFunc
- // ---------------------------------------------
- // function to unregister palette definition
-
- DefConst('kUnRegTapBarPaletteFunc,
- func(sym)
- begin
- call kUnRegTapBarSymbolFunc with ('palettes, sym);
-
- call kNotifyTapBarButtonRegistryFunc with ('paletteRemoved, sym);
- end);
-
-
- // ---------------------------------------------
- // kTapBarCreateNewBarFunc
- // ---------------------------------------------
- // function to unregister palette definition
-
- DefConst('kTapBarCreateNewBarFunc,
- func(groupSym, barPrefFrame)
- begin
- if groupSym then
- begin
- if NOT HasSlot(barPrefFrame, 'version)
- OR ClassOf(barPrefFrame.version) <> 'int then
- begin
- barPrefFrame := Clone(barPrefFrame);
- barPrefFrame.version := 0;
- end;
-
- local tb := GetGlobals().(kTapBarAppSym);
- if tb then
- begin
- tb:CreateNewBar(groupSym, barPrefFrame);
- end
- else
- begin
- call kRegTapBarSymbolFunc
- with ('bars, groupSym, barPrefFrame);
- end
- end
- end);
-
-
-